/* eslint-disable */
var CryptoJS = require('crypto-js');
//CBC模式加密
export function encryptByDESModeCBC(message) {
  var keyHex = CryptoJS.enc.Utf8.parse('pakj2018666');
  var ivHex = CryptoJS.enc.Utf8.parse('pakj2018666');
  encrypted = CryptoJS.DES.encrypt(message, keyHex, {
    iv: ivHex,
    mode: CryptoJS.mode.CBC,
    padding: CryptoJS.pad.Pkcs7
  });
  return encrypted.ciphertext.toString();
}
//ECB模式加密
export function encryptByDESModeEBC(message) {
  var keyHex = CryptoJS.enc.Utf8.parse('pakj2018666');
  var encrypted = CryptoJS.DES.encrypt(message, keyHex, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7
  });
  return encrypted.ciphertext.toString();
}
//DES  ECB模式解密
export function decryptByDESModeEBC(ciphertext) {
  var keyHex = CryptoJS.enc.Utf8.parse('pakj2018666');
  var decrypted = CryptoJS.DES.decrypt(
    {
      ciphertext: CryptoJS.enc.Hex.parse(ciphertext)
    },
    keyHex,
    {
      mode: CryptoJS.mode.ECB,
      padding: CryptoJS.pad.Pkcs7
    }
  );
  var result_value = decrypted.toString(CryptoJS.enc.Utf8);
  return result_value;
}
